package com.onpositive.simple.persistance;

public class Filter {

	public static final int LE=0;
	public static final int GE=1;
	public static final int LT=2;
	public static final int GT=3;
	public static final int EQ=4;
	
	protected final int kind;
	protected final String field;
	protected final Object bound;
	
	public Filter(int kind, String field, Object bound) {
		super();
		this.kind = kind;
		this.field = field;
		this.bound = bound;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((bound == null) ? 0 : bound.hashCode());
		result = prime * result + ((field == null) ? 0 : field.hashCode());
		result = prime * result + kind;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Filter other = (Filter) obj;
		if (bound == null) {
			if (other.bound != null)
				return false;
		} else if (!bound.equals(other.bound))
			return false;
		if (field == null) {
			if (other.field != null)
				return false;
		} else if (!field.equals(other.field))
			return false;
		if (kind != other.kind)
			return false;
		return true;
	}
}
